博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[React] {svg, css module, sass} support in Create React App 2.0
阅读量:4332 次
发布时间:2019-06-06

本文共 1882 字,大约阅读时间需要 6 分钟。

 added a lot of new features.

 

One of the new features is added the  webpack loader to wrap SVGs in React components as a named export. This let’s you either grab the filename from the default export or grab a wrapped SVG component depending on your needs.

 

Second of the new features is support for . If you start to use Sass, create-react-app will give you an error, but will give detailed instructions on how you can add Sass support to your project.

 

Thrid features is to add CSS Module support. CSS Modules automatically scope class names and animation names local by default to get around the problem of global name clashes. You can learn more by looking at the .

 

import React, {Component} from 'react';// ReactComponent support svgimport logo, {    ReactComponent as ReactLogo} from "./logo.svg";import './App.scss';// Supoortimport styles from './styles.module.css';class App extends Component {    render() {        return (            
logo

Edit src/App.js and save to reload.

Learn React
Learn React
); }}export default App;

 

App.scss:

.App-logo-svg {  height: 40vmin;  & g {    fill: salmon;  }  & path {    stroke: palegoldenrod;    fill: none;    stroke-width: 10px;    stroke-dasharray: 35px 15px;    animation: orbit 1s infinite linear;  }}@keyframes orbit { to { stroke-dashoffset: 50px; } }

 

styles.module.css:

.warning {
color: black; background-color: yellow;}.error {
color: white; background-color: red;}

 

转载于:https://www.cnblogs.com/Answer1215/p/9744049.html

你可能感兴趣的文章
第43条:掌握GCD及操作队列的使用时机
查看>>
Windows autoKeras的下载与安装连接
查看>>
CMU Bomblab 答案
查看>>
微信支付之异步通知签名错误
查看>>
2016 - 1 -17 GCD学习总结
查看>>
linux安装php-redis扩展(转)
查看>>
Vue集成微信开发趟坑:公众号以及JSSDK相关
查看>>
技术分析淘宝的超卖宝贝
查看>>
i++和++1
查看>>
react.js
查看>>
P1313 计算系数
查看>>
NSString的长度比较方法(一)
查看>>
Azure云服务托管恶意软件
查看>>
My安卓知识6--关于把项目从androidstudio工程转成eclipse工程并导成jar包
查看>>
旧的起点(开园说明)
查看>>
生产订单“生产线别”带入生产入库单
查看>>
crontab导致磁盘空间满问题的解决
查看>>
java基础 第十一章(多态、抽象类、接口、包装类、String)
查看>>
Hadoop 服务器配置的副本数量 管不了客户端
查看>>
欧建新之死
查看>>